package com.yunjian.admin.controller;

import com.github.pagehelper.PageInfo;
import com.yunjian.admin.vo.WebResult;
import com.yunjian.core.basic.model.SRole;
import com.yunjian.core.basic.model.SRoleExample;
import com.yunjian.core.basic.service.SRoleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import io.swagger.annotations.ApiOperation;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author tsh721@126.com
 */
@Controller
@RequestMapping("/role")
public class RoleController {

    private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    private static final Logger logger = LoggerFactory.getLogger(RoleController.class);

    @Autowired
    private SRoleService roleService;

    @ResponseBody
    @RequestMapping("/list")
    @ApiOperation(value = "角色列表")
    public WebResult<PageInfo<SRole>> list() {
        WebResult<PageInfo<SRole>> ret = new WebResult<>();
        SRoleExample example = new SRoleExample();
        example.createCriteria().andStatusEqualTo(1);
        ret.setAttach(roleService.selectPagedByExample(1, Integer.MAX_VALUE, example));
        return ret.setCoder(WebResult.Coder.SUCCESS);
    }

}
